import Vue from 'vue'
import App from './App.vue'
import router from './router'

import '@/styles/reset.css'
import '@/styles/iconfont.css'

import {
	Toast,
	Notify,
	Image as VanImage,
	Icon,
	Dialog,
	NavBar,
	Uploader,
	Field,
	Cell,
	CellGroup,
	ActionSheet,
	Tab,
	Tabs,
	List,
	PullRefresh,
	Button,
	Divider,
	Empty,
	SwipeCell,
	Tag,
	Search 
} from 'vant';
Vue.use(Toast);
Vue.use(Notify)
Vue.use(VanImage)
Vue.use(Icon)
Vue.use(Dialog)
Vue.use(NavBar)
Vue.use(Uploader)
Vue.use(Field)
Vue.use(Cell);
Vue.use(CellGroup);
Vue.use(ActionSheet);
Vue.use(Tab);
Vue.use(Tabs);
Vue.use(List);
Vue.use(PullRefresh);
Vue.use(Button);
Vue.use(Divider);
Vue.use(Empty);
Vue.use(SwipeCell);
Vue.use(Tag);
Vue.use(Search);

import request from './utils/request.js'
import moment from 'moment'

// 全局过滤器
Vue.filter('imgUrl', val => val.indexOf('http') === -1 ? request.defaults.baseURL + val : val)
Vue.filter('formatTime', val => moment(val).format('YYYY-MM-DD  hh:mm:ss'))


// 自定义指令
Vue.directive('focus', {
	update(dom) {
		// console.log(dom)
		dom.focus()
	}
})


Vue.config.productionTip = false

new Vue({
	router,
	render: h => h(App)
}).$mount('#app')
